# -*- coding: iso-8859-1 -*-
#
#    This is part of Malvinas Argentinas Messenger
#
#    Malvinas Argentinas Messenger is free software; you can redistribute
#    it and/or modify it under the terms of the GNU General Public License
#    as published by the Free Software Foundation; either version 2 of the
#    License, or (at your option) any later version.
#
#    Malvinas Argentinas Messenger is distributed in the hope that it will be
#    useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Malvinas Argentinas Messenger; if not, write to the Free
#    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
#    MA  02110-1301  USA

import msgWin, msg, button
import gettext
_ = gettext.gettext

def handleOption(ui, i):
	if i <> -2:
		ui.options_win = 0		
		if i <> -1:
			ui.options_index = -1
			ui.options_list = 0
		if not i:
			ui.mam.m.groupdel(str(ui.mam.contactListManager.gList.groupinList(ui.winOpt2.gname)))
		#ui.printMsg('\n%s ' % str(i), ui.COLORS.WHITE)
		del ui.winOpt2
		ui.refreshScr()

# We create the MsgWin
def showWin(mam):
		gname = mam.contactListManager.gList.numtoGroup(mam.contactListManager.default_group)
		msgWin.MsgWin(mam, _("DELETE GROUP"), \
		[msg.Msg(_("Are you sure you want to delete the group"), '', 1), \
		msg.Msg(gname, mam.ui.COLORS.OPTIONS_WIN4, 0), \
		msg.Msg(" ?", '', 1), \
		msg.Msg("", '', 1), \
		msg.Msg(_("NOTE: All the users in the group"), '', 1), \
		msg.Msg(_("will be deleted too") + ".", '', 1)], \
		[button.Button(_("YES"), 0), button.Button(("NO"), 1)], mam.ui.maxX * 5 / 7)
		mam.ui.winOpt2.gname = gname
